#include<stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    pid_t  id = fork();
    pid_t PID = getpid();
    pid_t PPID=getppid();
    int val=0;
    if(id>0)
    {
        while(1)
        {
            printf("I am a parent process PID:%d,PPID:%d,fork return: %d,val:%d\n",PID,PPID,id,val);
            sleep(1);
        }
    }
    else if(id==0)
    {
        while(val<10)
        {
            printf("I am a child process PID:%d,PPID:%d,fork return: %d,val:%d\n",PID,PPID,id,val);
            val++;
            sleep(1);
        }
    }
}
